using GammaJul.ReSharper.GammaXaml.Psi.Xaml;
using JetBrains.Annotations;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Daemon;
using JetBrains.ReSharper.Psi.Xml.Tree;
using JetBrains.Util;

namespace GammaJul.ReSharper.GammaXaml.Highlightings.Xaml {

	/// <summary>
	/// An highlighting that indicates that a row span or column span definition setter value is out of range.
	/// </summary>
	[ConfigurableSeverityHighlighting(SeverityId, XamlProjectFileType.Name, OverlapResolve = OverlapResolveKind.WARNING)]
	public class GridSpanValueOutOfRangeHighlighting : GridDefinitionValueOutOfRangeHighlighting {
		private readonly int _definitionValue;

		/// <summary>
		/// Gets the value of the definition related to the span (eg: Row for RowSpan).
		/// </summary>
		public int DefinitionValue {
			get { return _definitionValue; }
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="GridSpanValueOutOfRangeHighlighting"/> class.
		/// </summary>
		/// <param name="valueToken">The token having an out of range value.</param>
		/// <param name="gridDefinitionSizes">Information about the grid definition sizes.</param>
		/// <param name="definitionType">The type of grid definition.</param>
		/// <param name="definitionValue">The value of the definition related to the span (eg: Row for RowSpan).</param>
		public GridSpanValueOutOfRangeHighlighting([NotNull] IXmlToken valueToken, [NotNull] ReadOnlyList<string> gridDefinitionSizes, GridDefinitionType definitionType, int definitionValue)
			: base(valueToken, gridDefinitionSizes, definitionType) {
			_definitionValue = definitionValue;
		}
	}

}
